<?php
namespace app\admin\service;
use think\Db;
class  User{

    //用户列表
    function userList(){
        $phone = input('phone');
        $where = null;
        if(!empty($phone)){
            $where['u_phone'] = $phone;
        }
        $nickname = input('nickname');
        if(!empty($nickname)){
            $where['u_nickname'] = array('like',"$nickname%");
        }
        $param         = input ( 'param.' );
        $paginate = 15;
        $user     = Db::name('user');
        $list     = $user->where($where)->order('u_addtime desc')->paginate($paginate);
        $page     = $list->render();
        $data['list'] = $list;
        $data['page'] = $page;
        $data['count'] = $user->count();
        $data['post'] = $param?$param:null;
        return $data;
    }

    //用户详情
    function userInfo(){
        $user_id = input('user_id');
        $data    = Db::name('user')->where('user_id',$user_id)->find();
        return $data;
    }


}
